package pokerantani.v2.linematchers;

import java.util.List;
import java.util.regex.Pattern;

import pokerantani.v2.LineMatcher;
import pokerantani.v2.RE;
import pokerantani.v2.model.Card;


public class ActionSummary extends LineMatcher {
	static final Pattern pActionSummary = Pattern.compile("Seat (" + RE.INT + "): (" + RE.PLAYER + ")(| \\(button\\))(| \\(small blind\\)| \\(big blind\\)) showed \\[(" + RE.CARD + ") (" + RE.CARD + ")\\] and (won|lost)( \\(\\$?" + RE.FLOAT + "\\))? with .*");

	public int seatNumber;
	public String playerName;
	public boolean button;
	public boolean smallBlind;
	public boolean bigBlind;
	public List<Card> cards;
	public boolean won;
	public float amount;
	
	public boolean match(String line) {
		if(match(line, pActionSummary)) {
			seatNumber = groupInt(1);
			playerName = group(2);
			button = group(3) != null;
			smallBlind = group(4).equals("small blind");
			bigBlind = group(4).equals("big blind");
			cards = groupCards(5, 6);
			won = group(7).equals("won");
			amount = groupFloat(8);
			return true;
		}
		return false;
	}
}
